<template>
	<view>
		<view class="image_top">
			<image src="/static/mine/fx7.png" mode=""></image>
			<view class="abs">
				<view class="t1">
					我的可用余额(元)
				</view>
				<view class="price">
					<view class="p1">
						{{userInfo.member.distribution_price}}
					</view>
					<view class="btn" @click="pageGo">
						提现记录
					</view>
				</view>
			</view>
			<view class="block_2">
				<view class="b_f">
					<view class="tit">提现金额</view>
					<view class="price_flex">
						<view class="flex_l">
							<span>￥</span>
							<input placeholder-class="inputs" v-model="value" type="number" placeholder="请输入" />
						</view>
						<view class="btn" @click="alltx">
							全部提现
						</view>
					</view>
					<view class="flex_1">
						<view class="">
							提现至
						</view>
						<view class="z_flex" style="font-size: 28rpx;">
							<image src="/static/mine/yh.png" mode=""></image>
							银行卡账户
						</view>
					</view>
				</view>
				<view class="btns" @click="handleTx">
					申请提现
				</view>
			</view>
			<view class="tests">
				<view class="tit">
					温馨提示
				</view>
				<view class="tt">
					1、单笔提现金额需大于1元
				</view>
				<view class="tt">
					2、提现申请后预计将在三个工作日内将款项发放至您的微信账户中
				</view>
				<view class="tt">
					3、您理解并同意，当提现申请审核通过后，提现金额将由本平台委托的第三方公司(即“帮帮有限公司”)代为转账，每笔2元手续费4、在法律法规允许的范围内对本次规则进行解释并作出适当修改，如有疑问，请联系客服
				</view>
			</view>
		</view>
	</view>
</template>

<script>

	export default {
		data() {
			return {
				imgurl: getApp().globalData.WEBIMG,
				value: '',
				userInfo:{}

			};
		},
		onLoad() {
			this.$post('user/index', {
				mid: uni.getStorageSync('msg').id
			}).then(res => {
				if (res.code == 0) {
					this.userInfo = res.data
				}
			})
		},
		methods: {
			pageGo(){
				uni.navigateTo({
					url:'/minepage/txrecord'
				})
			},
			goback(){
				uni.navigateBack()
			},
			alltx() {
				this.value = this.userInfo.member.distribution_price
			},
			handleTx() {
				if (this.value == '') {
					uni.showToast({
						icon: 'none',
						title: "请输入提现金额",
					})
					return
				}
				// if (this.value < 1) {
				// 	uni.showToast({
				// 		icon: 'none',
				// 		title: "不满足提现金额",
				// 	})
				// 	return
				// }
				this.$post('distribution/withdraw_add', {
					price:this.value*100,
					mid: uni.getStorageSync('msg').id
				}).then(res => {
					if (res.code == 0) {
						uni.showToast({
							icon:'success',
							title:'提现已申请'
						})
						this.price = ''
					}
				})
			},
			pagetx() {
				uni.navigateTo({
					url: '/mypage/proxy/txrecord'
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background: #F2F2F2;
	}
	.image_top {
		width: 710rpx;
		position: relative;
		height: 200rpx;
		margin: 20rpx auto;
		image {
			width: 710rpx;
			height: 200rpx;
		}
		.abs {
			position: absolute;
			width: 710rpx;
			height: 200rpx;
			top: 0%;
			padding: 34rpx 30rpx;
			box-sizing: border-box;
			.t1{
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 30rpx;
				color: #FFFFFF;
			}
			.price {
				display: flex;
				justify-content: space-between;
				align-items: center;
				.p1 {
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					font-size: 64rpx;
					color: #fff;
					line-height: 64rpx;
					margin-top: 30rpx;
				}
				.btn {
					width: 168rpx;
					height: 68rpx;
					border-radius: 60rpx 60rpx 60rpx 60rpx;
					background: linear-gradient( 90deg, #454256 0%, #080F21 100%);
					line-height: 68rpx;
					text-align: center;
					font-size: 26rpx;
					color: #fff;
				}
			}

		}
}

	.block_2 {
		width: 710rpx;
		background: #FFFFFF;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		margin: 40rpx auto 0rpx;
		padding: 44rpx 20rpx;
		box-sizing: border-box;
		.b_f {
			padding: 0rpx 20rpx;

			.tit {
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color: #000000;
			}

			.price_flex {
				display: flex;
				align-items: center;
				justify-content: space-between;
				border-bottom: 1px solid #eee;
				padding-bottom: 20rpx;
				margin-top: 32rpx;

				.flex_l {
					display: flex;
					font-family: 'DINB';
					font-weight: bold;
					font-size: 40rpx;
					color: #000000;
					flex: 1;
					align-items: center;
				}

				.inputs {
					font-weight: 400;
					font-size: 30rpx;
				}

				.btn {
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #FF7416;
				}
			}

			.flex_1 {
				display: flex;
				justify-content: space-between;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color: #000000;
				margin: 40rpx auto;
				.z_flex{
					display: flex;
					align-items: center;
				}
				image {
					width: 48rpx;
					height: 48rpx;
					margin-right: 10rpx;
				}
			}
		}

		.btns {
			width: 670rpx;
			height: 80rpx;
			background: linear-gradient( 90deg, #454256 0%, #080F21 100%);
			border-radius:40rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: #FFFFFF;
			text-align: center;
			line-height: 80rpx;
		}
	}

	.tests {
		padding: 28rpx 20rpx;
		box-sizing: border-box;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #979797;
		.tit {
			font-weight: bold;
			font-size: 32rpx;
		}

		.tt {
			margin: 10rpx auto;
		}
	}
</style>